home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1996 #6
/
Amiga Plus CD - 1996 - No. 06.iso
/
pd
/
disktools
/
hdsleep
/
source
/
beginio.a
next >
Wrap
Text File
|
1996-08-04
|
2KB
|
77 lines
SECTION assembly,code
XREF _OldBeginIO
XREF _Computer
include "lvo/exec_lib.i"
;
; Call scsi.device BeginIO()
; void CallBeginIO(struct register __a1 struct IORequest *);
;
XDEF _CallBeginIO
_CallBeginIO:
move.l _OldBeginIO,-(sp)
rts
;
; Turn unit D0 to sleep
; void HDDriveOff(register __d0 UBYTE HDUnit);
;
XDEF _HDDriveOff
_HDDriveOff:
move.l (4).w,a0 ; Get ExecBase
jsr _LVOForbid(a0)
jsr ChangeUnit ; ChangeUnit();
cmp.l #0,_Computer ; if 1 then a4000
beq a1200
lea $dd203e,a0 ; HD command register (A1200)
bra skip
a1200: lea $da201e,a0 ; HD command register (A4000)
skip: move.b #$e0,(a0) ; Standby Immediate
move.b #$e3,(a0) ; Idle
OffEnd: move.l (4).w,a0 ; Get ExecBase
jsr _LVOPermit(a0) ; Permit();
rts
;
; Check unit D0 for hd present (does it work?)
; UBYTE CheckHD(register __d0 UBYTE HDUnit);
;
XDEF _CheckHD
_CheckHD:
move.l (4).w,a0 ; Get ExecBase
jsr _LVOForbid(a0)
jsr ChangeUnit ; ChangeUnit();
clr.b d0
tst.l _Computer ; if 1 then a4000
beq a4k3
cmpi.b #$50,($da201e) ; HD status register (A1200)
seq d0 ; if(DrivePresent) d0=TRUE;
bra skip2
a4k3: cmpi.b #$50,($dd203e) ; HD status register (A4000)
seq d0 ; if(DrivePresent) d0=TRUE;
skip2: move.l (4).w,a0 ; Get ExecBase
jsr _LVOPermit(a0)
rts
;
; Change to Unit D0
; void ChangeUnit(register __d0 UBYTE HDUnit);
;
ChangeUnit:
asl.l #4,d0
ori.w #$a0,d0
cmp.l #0,_Computer ; if 1 then a4000
beq a12002
move.b d0,($dd203a) ; HD drive/unit register (A1200)
rts
a12002: move.b d0,($da201a) ; HD drive/unit register (A4000)
rts
end